package view;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class ImagePanel extends JPanel {
	private static final long serialVersionUID = 1L;
	public String src;

    public ImagePanel(String src) {
        this.src = src;
        this.setOpaque(false);

    }

    public ImagePanel() {
        this.src = "icon/a_1.png";
        this.setOpaque(false);
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Image image = new ImageIcon(src).getImage();
//        System.out.println(image.getWidth(this));
        Dimension d = getSize();
        g.drawImage(image, 0, 0, d.width, d.height, null);
    }

}
